Component({
    externalClasses: ['custom-class'],
    properties: {
        zIndex: {
            type: [Number, String],
            value: 90,
        },
        openType: {
            type: [String],
            value: 'navigate',
        },
    },
    options: {
        addGlobalClass: true
    },
    data: {
        startInit: 0,
        range: 0,
        once: true,
        endPost: 0
    },
    lifetimes: {
        attached() {
        },
        detached() {
        },
    },
    methods: {
        handlerStart(e) {
            this.data.startInit = parseInt(e.touches[0].clientY)
            if (this.data.range !== 0) {
                this.data.once = false
            }
            if (!this.data.once) {
                this.data.endPost = this.data.range
            }
        },
        handlerMove(e) {
            const Y = parseInt(e.touches[0].clientY)
            const range = Y - this.data.startInit
            if (this.data.once) {
                this.setData({
                    range
                })
            } else {
                this.setData({
                    range: this.data.endPost + range
                })
            }
        },
        handlerEnd() {
            this.data.startInit = 0
        }
    }
})
